﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Odbc;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using NahidaPrjoect4CSharp.Database;

namespace NahidaProject4CSharp.Database.FunctionalTest
{
	internal class Program
	{
		static void Main(string[] args)
		{
			string connectionString = "your_connection_string_here";
			using (ODBC helper = new ODBC(connectionString))
			{
				helper.OpenConnection();
				helper.BeginTransaction();

				try
				{
					// 执行查询
					DataTable result = helper.ExecuteQuery("SELECT * FROM your_table WHERE your_column = ?", new OdbcParameter("your_column", 1));

					// 执行非查询命令
					int rowsAffected = helper.ExecuteNonQuery("UPDATE your_table SET your_column = ? WHERE another_column = ?", new OdbcParameter("your_column", 1), new OdbcParameter("another_column", 1));

					// 提交事务
					helper.CommitTransaction();
				}
				catch (Exception ex)
				{
					// 回滚事务
					helper.RollbackTransaction();
					Console.WriteLine("Error: " + ex.Message);
				}
			}
		}
	}
}
